<?php
/* @var $this SiteController */

$this->pageTitle = Yii::app()->name;
?>

<!-- Example row of columns -->
<div class="row">
    <div class="col-lg-2">
    </div>
    <div class="col-lg-8">
        <?php if (count($data) > 0) { ?>
            <table class="table table-bordered">
                <tr>
                    <th width="5%">No</th>
                    <th>Project</th>
                    <th>Status</th>
                    <th>Transaction type</th>
                    <th>Transaction date</th>
                    <th width='10%'></th>
                    <th width='10%'></th>
                </tr>
                <?php
                $index = 1;

                foreach ($data as $row) {
                    ?>
                    <tr>
                        <td><?php echo $index++; ?></td>
                        <td><?php echo $row['ideality']['title']; ?></td>
                        <td><?php echo Transaction::getStatusName($row['trans_status']); ?></td>
                        <td><?php echo Transaction::getTransTypeName($row['trans_type']); ?></td>
                        <td><?php echo $row['create_datetime']; ?></td>
                        <?php
                        if ($row['trans_status'] == Param::TRANS_STATUS_BUYED) {
                            echo '<td>' . CHtml::link('download', array('/site/download', "ideality_id" => $row["ideality_id"])) . '</td>';
                        }
                        else {
                            echo '<td></td>';
                        }
                        ?>
                        <?php
                        if (($row['trans_status'] == Param::TRANS_STATUS_BUYED) ||($row['trans_status'] == Param::TRANS_STATUS_CANCEL)) {
                            ?>

                            <td> <?php echo CHtml::link('Delete', '#', array('submit' => array('transaction/delete', 'id' => $row['trans_id']), 'confirm' => 'Are you sure you want to delete this transaction?', 'class' => 'btn btn-danger btn-xs')); ?></td>
                        <?php }

                        ?>
                    </tr>

                <?php
                }
                ?>
            </table>
        <?php } ?>
        <?php
        if (count($data) == 0) {
            echo 'No data available for this category';
        }
        ?>


    </div>

</div>

